from models import Blog
from django.shortcuts import render_to_response
from django.template import RequestContext


def home(request):
	return render_to_response('index.html', RequestContext(request))

def create_category(request):
    if request.POST:
		new_blog = Blog.objects.create(category=request.POST['category'])
		return render_to_response('availablePosts.html' ,{ 'blogs' : Blog.objects.all()},RequestContext(request))    
		
    else:
        return render_to_response('create_category.html', RequestContext(request))
		
def availablePosts(request):
    blogs = Blog.objects.all()
    return render_to_response('availablePosts.html' ,{ 'blogs' : blogs },RequestContext(request))
		